<include file="Public:header"/>
<!--主页面-->
<div id="main-content" class="content">
    <ul class="breadcrumb">
        <li><a href="/">首页</a></li>
        <li class="active"><a href="">会员管理</a></li>
        <li class="active">会员列表</li>
    </ul>

    <div class="page-header page-header1 clearfix">
        <h3>会员管理</h3>
        <ul class="nav nav-tabs">    
            <li class="active">
                <a href="{:U('Member/memberList')}">会员列表</a>
            </li>
            <li>
                <a href="{:U('Member/addMember')}">添加会员</a>
            </li>
        </ul>
    </div>
    <div class="search-content">
        <form action="{:U('Member/memberList')}" method="post"class="search-form form-inline" role="form">
            <div class="form-group">
                <label class="sr-only" for="m_nickname">会员姓名</label>
                <input class="earch-input form-control" id="m_nickname" type="text" name="m_nickname" value="{$request['m_nickname']}" placeholder="会员姓名"/>　
            </div>
            <div class="form-group">
                <select name="m_type" class="form-control input-sm">
                    <option value="">--会员类型--</option>
                    <option value="1" <if condition="$request['m_type'] eq 1">selected=true</if>>公司员工</option>
                    <option value="2" <if condition="$request['m_type'] eq 2">selected=true</if>>项目客户</option>
                </select>
            </div>
            <div class="form-group">
                <select name="z_id" class="form-control input-sm">
                    <option value="">--职位--</option>
                    <volist name="position" id="vo" key="k">
                        <option value="{$k}" <if condition="$request['z_id'] eq '$k'">selected=true</if>>{$vo}</option>
                    </volist>
                </select>
            </div>
            <button type="submit" class="btn derive">查询</button>　
        </form>
    </div>
    <div class="content-box-table">
        <form action="{:U('Member/deleteMember')}" method="post" class="batch-form">
            <table class="table table-striped table-framed table-hover">
                <thead>
                    <tr>
                        <th width="4%">
                            <input class="check-all" type="checkbox" />
                        </th>
                        <th>注册时间</th>
                        <th>姓名</th>
                        <th>帐号</th>
                        <th>电话</th>
                        <th>类型</th>
                        <th>性别</th>
                        <th width="10%">操作</th>
                    </tr>
                </thead>
                <tbody class="tbody">
                    <if condition="empty($mem_list)">
                        <tr><td colspan="20"><span style="font-size:14px;">暂无数据</span></td></tr>
                    </if>
                    <volist name="mem_list" id="mem">
                        <tr>
                            <td><input type="checkbox" value="{$mem['m_id']}" name="m_id[]"/></td>
                            <td>{$mem['ctime']|date='Y-m-d',###}</td>
                            <td>{$mem['m_nickname']|default="未填写"}</td>
                            <td>{$mem['m_account']|default="未填写"}</td>
                            <td>{$mem['m_mobile'] == 0 ? '未填写' : $mem['m_mobile']}</td>
                            <td>{$mem['p_name']}</td>
                            <td>{$mem['m_sex']}</td>
                            <td>
                                <a href="{:U('Member/editMember',array('m_id'=>$mem['m_id']))}" title="编辑" class="modify">
                                   <span class="icon glyphicon glyphicon-pencil"></span>
                                </a>&nbsp;
                                <a href="#" title="删除" class="delete-delete">
                                    <span class="icon glyphicon glyphicon-remove"></span>
                                </a><input type="hidden" value="{:U('Member/deleteMember',array('m_id'=>$mem['m_id']))}">
                            </td>
                        </tr>
                    </volist>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="20">
                            <div class="bulk-actions fl">
                                <input type="button" class="btn delete-batch" value="批量删除">　
                                <a href="#excel" title="导出EXCEL" rel="modal">
                                    <input type="button" class="btn derive" value="导出EXCEL" data-toggle="modal" data-target="#excel">
                                </a>
                            </div>
                            <div class="fr">
                                {$page}
                                <!-- <span>转到第<input type="text" id='page_num'>页</span>
                                <input type="button" value="GO" id="go">
                                <input type="hidden" id="url" value="{$url}">
                                <input type="hidden" id="p" value="{$request['p']}"> -->
                            </div>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </form>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="excel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">导出数据字段选择</h4>
      </div>
      <div class="modal-body">
        <form action="{:U('Member/exportExcel')}" method="post">
        <!-- 选择字段 -->
        <div style="line-height: 30px;">
            <input type="checkbox" value="注册时间||ctime" name="fields_data[]" checked/>&nbsp;注册时间　
            <input type="checkbox" value="昵称||m_nickname" name="fields_data[]" checked/>&nbsp;昵称　
            <input type="checkbox" value="邮箱||m_email" name="fields_data[]" checked/>&nbsp;邮箱　
            <input type="checkbox" value="电话||m_mobile" name="fields_data[]" checked/>&nbsp;电话　
            <input type="checkbox" value="微信||m_wchart" name="fields_data[]" checked/>&nbsp;微信　
            <input type="checkbox" value="性别||m_sex" name="fields_data[]" checked/>&nbsp;性别　
            <input type="checkbox" value="积分||m_score" name="fields_data[]" checked/>&nbsp;积分　
            <input type="checkbox" value="点击量||m_click" name="fields_data[]" checked/>&nbsp;点击量　
        </div>
        <div style="margin-top:20px;">
            <input type="submit" class="btn btn-grren" value="确认导出" onclick="face_hide()">　
            <span class='prompt'>(导出数据为当前筛选条件下的所有数据)</span>
        </div>
        <!-- 筛选条件 -->
        <div style="display: none">
            <input type="text" name="m_id" value="{$request['m_id']}"/>　
            <input type="text" name="m_nickname" value="{$request['m_nickname']}"/>　
            <select name="m_sex">
                <option value=""></option>
                <option value="1" <if condition="$request['m_sex'] eq 1">selected=true</if>></option>
                <option value="2" <if condition="$request['m_sex'] eq 2">selected=true</if>></option>
            </select>　
            <select name="sort_order">
                <option value=""></option>
                <option value="m_score:asc" <if condition="$request['sort_order'] eq 'm_score:asc'">selected=true</if>></option>
                <option value="m_score:desc" <if condition="$request['sort_order'] eq 'm_score:desc'">selected=true</if>></option>
            </select>
        </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" onclick="face_hide()" data-dismiss="modal">确认</button>
      </div>
    </div>
  </div>
</div>
<!-- Modal end-->

<script type="text/javascript">
    $(document).ready(function(){
        //排序修改
        $("select[name='z_id']").change(function(){
            $('.search-form').submit();
        });
        //批量修改积分
        $('.edit-score-batch').click(function(){
            $('.batch-form').attr('action','{:U("Member/editScoreBatch")}');
            $('.batch-form').submit();
        });
    });
</script>
<include file="Public:footer"/>
